package com.youlai.boot.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.youlai.boot.system.mapper.DocumentMapper;
import com.youlai.boot.system.model.QB.Document;
import com.youlai.boot.system.service.DocumentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> implements DocumentService {
    private static final Logger logger = LoggerFactory.getLogger(DeviceServiceImpl.class);
    @Autowired
    private DocumentMapper documentMapper;
    @Override
    public boolean saveDocument(Document document) {

        document.setAddtime(LocalDateTime.now());
        return save(document);
    }

    @Override
    public List<Document> getAllDocument() {
        return documentMapper.selectList(null);
    }

    @Override
    public boolean deleteDocumentById(Integer id) {
        return baseMapper.deleteById(id) > 0;
    }
}
